//
//  UIBarButtonItem+Extension.swift
//  HL-sinaWeiBo
//
//  Created by 任翰林 on 16/5/12.
//  Copyright © 2016年 任翰林. All rights reserved.
//

import UIKit


extension UIBarButtonItem {


//    使用便利构造函数，创建UIBarButtonItem对象
    convenience init(title: String , fountSize: CGFloat , target: AnyObject? , action: Selector) {

        self.init()
        
        let button = UIButton()
        
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        button.setTitle(title, forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.titleLabel?.font = UIFont.systemFontOfSize(fountSize)
        button.sizeToFit()
        customView = button
        
        
    }

}
